function sec3_val(){
//$("#scheme_section1").show();

	if($("#source").length > 0){
		if($("#source").val()==0){
		alert("select source");
		return false;
		}
	
	}

	/*
	if(document.getElementById("Location").value == ""){
	alert("Enter Location");
	document.getElementById("Location").focus();
	return false;
	}
	if($("#Longitude").val()==""){
		alert("Enter Longitude");
		document.getElementById("Longitude").focus();
		return false;
	}
	if($("#Latitude").val()==""){
	alert("Enter Latitude");
	document.getElementById("Latitude").focus();
	return false;
	}
	*/
	if($("#source_status_op").attr("checked")){
			//alert($("#yeildMin").val()+ "---" + $("#yeildMax").val() );
			if($("#yeildMin").val()!="" &&  $("#yeildMax").val()!="") {
				var minvalue = Number($("#yeildMin").val());
				var maxvalue = Number($("#yeildMax").val());
				if(minvalue > maxvalue){
				//if($("#yeildMin").val() > $("#yeildMax").val()){
				alert(" Yield Min must less than Yield Max");
				$("#yeildMax").focus();
				return false;
				}
			}
			if($("#waterMin").val()!="" &&  $("#waterMax").val()!="") {
				var minvalue = Number($("#waterMin").val());
				var maxvalue = Number($("#waterMax").val());
				if(minvalue > maxvalue){
				//if($("#waterMin").val() > $("#waterMax").val()){
				alert("Water Table Fluctuations (m) Min must less than  Water Table Fluctuations (m) Max");
				$("#waterMax").focus();
				return false;
				}
			}
			
	}
	/*
	if($("#pH").val()==""){
	alert("Enter pH");
	document.getElementById("pH").focus();
	return false;
	}
	if($("#TDS").val()==""){
	alert("Enter TDS");
	document.getElementById("TDS").focus();
	return false;
	}
	if($("#cl").val()==""){
	alert("Enter cl (mg/l");
	document.getElementById("cl").focus();
	return false;
	}
	if($("#F").val()==""){
	alert("Enter F");
	document.getElementById("F").focus();
	return false;
	}
	if($("#no3").val()==""){
	alert("Enter No.3");
	document.getElementById("no3").focus();
	return false;
	}
	*/
	
}

function sec1_val(){
	
	if($("#scheme_name").val()==""){
	alert("Enter scheme name");
	document.getElementById("scheme_name").focus();
	return false;
	}
	if($("#YOC").val()==""){
	alert("Enter Year of Commissioning");
	document.getElementById("YOC").focus();
	return false;
	}
	if($("#CC").val()==""){
	alert("Enter Capital Cost");
	document.getElementById("CC").focus();
	return false;
	}
	if($("#scheme_sactioned").val()==0){
	alert("Select Schemes Sanctioned");
	document.getElementById("scheme_sactioned").focus();
	return false;
	}
	else if($("#scheme_sactioned").val()=="Other"){
			if($("#scheme_sactioned_other").val()==""){
			alert("Enter Other's Schemes Sanctioned Value");
			document.getElementById("scheme_sactioned_other").focus();
			return false;
			}
		
	}
	

}

function sec5_val(){
	/*
	if(document.getElementById("Location").value == ""){
	alert("Enter Location");
	document.getElementById("Location").focus();
	return false;
	}
	if($("#Longitude").val()==""){
		alert("Enter Longitude");
		document.getElementById("Longitude").focus();
		return false;
	}
	if($("#Latitude").val()==""){
	alert("Enter Latitude");
	document.getElementById("Latitude").focus();
	return false;
	}
	*/

	if($("#Status").val() ==0){
	alert("Select Status field");
	$("#Status").focus();
	return false;
	}
	if($("#Discharge").val() ==""){
	alert("Enter Discharge value");
	$("#Discharge").focus();
	return false;
	}
	if($("#Head").val() ==""){
	alert("Enter Head value");
	$("#Head").focus();
	return false;
	}
	if($("#Power").val() ==0){
	alert("Enter Power Rating value");
	$("#Power").focus();
	return false;
	}
	/*
	if($("#pH").val()==""){
	alert("Enter pH");
	document.getElementById("pH").focus();
	return false;
	}
	if($("#TDS").val()==""){
	alert("Enter TDS");
	document.getElementById("TDS").focus();
	return false;
	}
	if($("#cl").val()==""){
	alert("Enter cl (mg/l");
	document.getElementById("cl").focus();
	return false;
	}
	if($("#F").val()==""){
	alert("Enter F");
	document.getElementById("F").focus();
	return false;
	}
	if($("#no3").val()==""){
	alert("Enter No.3");
	document.getElementById("no3").focus();
	return false;
	}
	*/

}

function sec6_val(){
	/*
	if(document.getElementById("Location").value == ""){
	alert("Enter Location");
	document.getElementById("Location").focus();
	return false;
	}
	if($("#Latitude").val()==""){
	alert("Enter Latitude");
	document.getElementById("Latitude").focus();
	return false;
	}
	if($("#Longitude").val()==""){
		alert("Enter Longitude");
		document.getElementById("Longitude").focus();
		return false;
	}
	*/
		if($("#cap").val()==""){
		alert("Enter Capacity(kl)");
		document.getElementById("cap").focus();
		return false;
	}
	/*
		if($("#pH").val()==""){
	alert("Enter pH");
	document.getElementById("pH").focus();
	return false;
	}
	if($("#TDS").val()==""){
	alert("Enter TDS");
	document.getElementById("TDS").focus();
	return false;
	}
	if($("#cl").val()==""){
	alert("Enter cl (mg/l");
	document.getElementById("cl").focus();
	return false;
	}
	if($("#F").val()==""){
	alert("Enter F");
	document.getElementById("F").focus();
	return false;
	}
	if($("#no3").val()==""){
	alert("Enter No.3");
	document.getElementById("no3").focus();
	return false;
	}
	*/



}

function float1(field,mini,maxi)
{
			
	var value1 = field.value;
	var arr=value1.split(".");
	if(arr[0].length>2)
	{
		alert("Invalid entry! Enter Only Two Digit before Decimal");
		field.value="";
		field.focus();
		return false;
	}
	if(value1 != "")
	{
		if (!(value1.match(/^\d*\.\d*$/)))
		{
			alert("Invalid entry! Enter Only Decimal Values (eg "+mini+".12345)");
			//field.focus();
			field.value="";
			field.focus();
			return false;
		}
	}
	
	if(value1.indexOf(".") != -1)
	{
		if(!/\.[0-9]{5}$/.test(value1))
		{
			alert("Invalid entry! Enter Only Five Digit after Decimal (eg "+mini+".12345)");
			field.value="";
			field.focus();
			return false;
		}
	}
	if(field.value<mini || field.value>maxi)
    {
		alert('Please Enter Value before Decimal in Between '+mini+'-'+maxi);
		field.value="";
		field.select();
		return false;
	}

return true;
}

function check(field,mini,maxi)
{
	var valid = "0123456789"
    var ok = "yes";
    var temp;
    for (var i=0; i<field.value.length; i++) {
    temp = "" + field.value.substring(i, i+1);
    if (valid.indexOf(temp) == "-1") ok = "no";
    }
    if (ok == "no") {
    alert("Invalid entry! Only Numeric Characters are Accepted!");
	field.value="";
    //field.focus();
    field.select();
    return false;
    }
	
	var value1 = field.value;
	if(value1.indexOf(".") != -1)
	{
		if(!/\.[0-9]{1,1}$/.test(value1))
		{
			alert("Number Should be One Digit after Decimal");
			field.value="";
			field.focus();
			return false;
		}
	}
	if(field.value<mini || field.value>maxi)
    {
		alert('Please Check Entered Value');
		field.value="";
		field.select();
		return false;
	}

return true;
}

function check1(field,mini,maxi)
{
	var valid = "0123456789."
    var ok = "yes";
    var temp;
    for (var i=0; i<field.value.length; i++) {
    temp = "" + field.value.substring(i, i+1);
    if (valid.indexOf(temp) == "-1") ok = "no";
    }
    if (ok == "no") {
    alert("Invalid entry! Only Numeric Characters are Accepted!");
	field.value="";
    //field.focus();
    field.select();
    return false;
    }
	
	var value1 = field.value;
	if(value1.indexOf(".") != -1)
	{
		if(!/\.[0-9]{1,1}$/.test(value1))
		{
			alert("Number Should be One Digit after Decimal");
			field.value="";
			field.focus();
			return false;
		}
	}
	if(field.value<mini || field.value>maxi)
    {
		alert('Please Check Entered Value');
		field.value="";
		field.select();
		return false;
	}

return true;
}

function float2dec(field)
{	
	var value1 = field.value;
	if(isNaN(value1))
	{
		alert("Invalid entry! Only integer and decimal values are accepted!");
		field.value="";
		field.focus();
		return false;
	}
	if(value1.indexOf(".") != -1)
	{
		if(!/\.[0-9]{2}$/.test(value1))
		{
			alert("Number should be two digit after decimal");
			field.value="";
			field.focus();
			return false;
		}
	}	
}

function int(field)
{	
	var value1 = field.value;
	if(isNaN(value1))
	{
		alert("Invalid entry! Only integer values are accepted!");
		field.value="";
		field.focus();
		return false;
	}
	if(value1.indexOf(".") != -1)
	{
		alert("Invalid entry! Only integer values are accepted!");
		field.value="";
		field.focus();
		return false;
	}	
}

